package com.sname.car.common.resp;
import com.sname.car.common.constants.Constants;
import org.springframework.stereotype.Component;

/**
 * Created By  醉美柳舞之众星捧月
 * @author songx
 * @date 2018/9/21 22:15
 */
@Component
public class ApiResult<T> {
    private Boolean success;
    private int code;
    private String message;
    private T data;
    private static final String req_succ = "请求成功!";
    public ApiResult() {
        this.success = true;
        this.code = Constants.RESP_STATUS_CODE;
        this.message = req_succ;
        this.data = null;

    }
    public ApiResult(int code) {
        this.code = code;
    }
    public ApiResult(String message) {
        this.message = message;
    }
    public ApiResult(T data) {
        this.data = data;
    }
    public ApiResult(int code, String message) {
        this.code = code;
        this.message = message;
    }
    public ApiResult(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public ApiResult(Boolean success, int code, String message, T data) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public void setSuccess(Boolean success) {
        this.success = success;
    }
    public void setCode(int code) {
        this.code = code;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public void setData(T data) {
        this.data = data;
    }
}
